package com.omar.labs.tamtamy;

import com.omar.labs.tamtamy.JSON.JSONToken;
import com.omar.labs.tamtamy.XML.XMLToken;

/**
 * Implements the <a href="https://tamtamy.reply.it/wiki/API#Method_GET" target="_new">TamTamy Api Login via Method GET </a>.
 * 
 * @author Omar "0m4r" Adobati
 * @version %I%, %G% 
 *
 */
public class Token extends TamTamyAPI{

	protected String token;
	protected String xml;
	protected String json;

	public Token(){
		this.token = null;
		this.xml = null;
		this.json = null;
	}

	public Token(String token){
		new Token();
		this.token = token;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public void setXML(String token) {
		this.xml = xml;
	}

	public String getXML(){
		return xml;
	}

	public void setJSON(String token) {
		this.json = json;
	}

	public String getJSON(){
		return json;
	}
	
	public void print(boolean printResponse){
		System.out.println("== TOKEN ==");
		System.out.println("token: " + this.token);
		if(printResponse){
			if(TamTamyAPI.type.toUpperCase().indexOf(TamTamyAPI.REQ_XML)!=-1){
				System.out.println(this.xml);
			}else if(TamTamyAPI.type.toUpperCase().indexOf(TamTamyAPI.REQ_JSON)!=-1){
				System.out.println(this.json);  
			}
		}
	}


}
